package com.yylc.cscore.util;

import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author xiangnan
 * date 2018/5/10
 */
public class JobTriggerThreadFactory implements ThreadFactory {
    private static final AtomicInteger poolNumber = new AtomicInteger(1);
    private final String namePrefix;

    public JobTriggerThreadFactory() {
        namePrefix = "JobTriggerPool-" + poolNumber.getAndIncrement() + "-thread-";
    }

    @Override
    public Thread newThread(Runnable r) {
        return new Thread(r, namePrefix  + poolNumber.getAndIncrement());
    }
}
